package cn.wolfcode.shop.cloud.common;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

public class CommonExceptionAdvice {

    @ExceptionHandler(BusinessException.class)
    @ResponseBody
    public Result hanlder(BusinessException ex) {
        ex.printStackTrace();
        return Result.error(ex.getCodeMsg());
    }

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public Result hanlderCommon(Exception ex) {
        ex.printStackTrace();
        return Result.defaultError();
    }
}
